var numUnit=['','K','M','B','T']
for(var i=0;i<26;i++){
    let a1 = String.fromCharCode('a'.charCodeAt() + i)
    for(var j=0;j<26;j++){
        let a2 = String.fromCharCode('a'.charCodeAt() + j)
        numUnit.push(a1+a2)
    }   
}

/*var numUnit=['',
            'Thousand',
            'Million',
            'Billion',
            'Trillion',
            'Quadrillion',
            'Quintillion',
            'Sextillion',
            'Septillion',
            'Octillion',
            'Nonillion',
            'Decillion',
            'Undecillion',
            'Duodecillion',
            'Tredecillion',
            'Quattuordecillion',
            'Quinquadecillion',
            'Sedecillion',
            'Septendecillion',
            'Octodecillion',
            'Novendecillion',
            'Vigintillion',
            'Unvigintillion',
            'Duovigintillion',
            'Tresvigintillion',
            'Quattuorvigintillion',
            'Quinquavigintillion',
            'Sesvigintillion',
            'Septemvigintillion',
            'Octovigintillion',
            'Novemvigintillion',
            'Trigintillion',
            'Untrigintillion',
            'Duotrigintillion',
            'Trestrigintillion',
            'Quattuortrigintillion',
            'Quinquatrigintillion',
            'Sestrigintillion',
            'Septentrigintillion',
            'Octotrigintillion',
            'Noventrigintillion',
            'Quadragintillion',
            'Unquadragintillion',
            'Duoquadragintillion',
            'Tresquadragintillion',
            'Quattorquadragintillion',
            'Quinquaquadragintillion',
            'Sesquadragintillion',
            ]
            */
cc.Class({
    extends: cc.Label,

    properties: {
        // foo: {
        //     // ATTRIBUTES:
        //     default: null,        // The default value will be used only when the component attaching
        //                           // to a node for the first time
        //     type: cc.SpriteFrame, // optional, default is typeof default
        //     serializable: true,   // optional, default is true
        // },
        // bar: {
        //     get () {
        //         return this._bar;
        //     },
        //     set (value) {
        //         this._bar = value;
        //     }
        // },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
        
    },
    convertNumber (bigNumber) {
        if(bigNumber<1000){
            return bigNumber.toFixed(2) 
        }else{
            bigNumber = bigNumber.toFixed(0)
            let numberLen = Math.floor(Math.log10(bigNumber))            
            let a = Math.floor((numberLen)/3)
            let preNumber = (bigNumber / Math.pow(10,a *3)).toFixed(2) 
            let fixedNumber = preNumber + ' ' + numUnit[a]
            return fixedNumber 
        }
    },
    setNumber(numString, prefix='', suffix=''){
        this.string = prefix + this.convertNumber(Number(numString)) + suffix
    },
    // update (dt) {},
});
